package com.example.newapplication;

import java.util.Date;

import android.os.Bundle;
import android.app.Activity;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TimePicker;

public class MainActivity extends Activity implements View.OnClickListener {

	    private Button dialogButton;
	    private Button toastButton;
	    private dialogGenerator dialogGen;
	    private TimePicker firstTime;
	  
	    private EditText firstValue,secoundValue;
		
	    /** Called when the activity is first created. */
	    @Override
	    public void onCreate(Bundle savedInstanceState) {
	        super.onCreate(savedInstanceState);
	        setContentView(R.layout.activity_main);
	        
	        this.firstValue = (EditText)findViewById(R.id.firstValue);
	        this.secoundValue = (EditText)findViewById(R.id.secoundValue);
	       
	       
	        firstTime = (TimePicker)findViewById(R.id.timePicker1);
	        this.firstTime.setIs24HourView(true);
	        
	        firstTime.setOnTimeChangedListener(mStartTimeChangedListener);
	        
	        
	        
	        this.dialogButton = (Button)findViewById(R.id.dialogButton);
	        this.dialogButton.setOnClickListener(this);
	        this.toastButton = (Button)findViewById(R.id.toastButton);
	        this.toastButton.setOnClickListener(this);
	            
	    }
    	
	    
	    
	   // On Click listener for click dem Buttons 
	    public void onClick(View view) {
	    	if ( view == this.dialogButton ) {
	    		
	    		String temp = (firstTime.getCurrentHour().toString())+":";
	    		if (firstTime.getCurrentMinute() < 10){
	    			temp = temp + "00";
	    		}
	    		else{
	    			temp = temp+firstTime.getCurrentMinute().toString();	    		
	    		}
	    		dialogGen  = new dialogGenerator(this,temp = "Aktuelle eingetragene Zeit: "+temp,true);
	    	}
	    	
	    	else if ( view == this.toastButton ) {
	    		dialogGen = new dialogGenerator(this,firstValue.getText().toString(),true);
	    		
	    	}	    	
	    }   
	    
	    //Listener for TimePicker Listener
	    protected static TimePicker.OnTimeChangedListener mStartTimeChangedListener = new TimePicker.OnTimeChangedListener() {

	    	    public void onTimeChanged(TimePicker view, int hourOfDay, int minute) {
	    	        displayUpdater.updateDisplay(view, hourOfDay, minute);          
	    	    }
	    };
	    
	    protected static TimePicker.OnTimeChangedListener mNullTimeChangedListener =
	    	    new TimePicker.OnTimeChangedListener() {

	    	    public void onTimeChanged(TimePicker view, int hourOfDay, int minute) {

	    	    }
	    };

	       
}
